<?php


class statistics
extends mysql
{
	public function __construct()
	{
		parent::__construct();
	}
	
	/**
	* Find out some random number
	*/
	private function fake_counter()
	{
		return mt_rand(99, 2000);
	}
	
	/**
	* Find number of categories
	*/
	public function count_categories()
	{
		$counter = $this->row("SELECT COUNT(*) total FROM gallery_categories WHERE is_active='Y' AND is_approved='Y';");
		if(!isset($counter['total'])) $counter = array('total'=>$this->fake_counter());
		return $counter['total'];
	}
	
	/**
	* Find number of albums
	*/
	public function count_albums()
	{
		$counter = $this->row("SELECT COUNT(*) total FROM gallery_albums WHERE is_active='Y' AND is_approved='Y';");
		if(!isset($counter['total'])) $counter = array('total'=>$this->fake_counter());
		return $counter['total'];
	}
	
	/**
	* Find number of images
	*/
	public function count_images()
	{
		$counter = $this->row("SELECT COUNT(*) total FROM gallery_images WHERE is_active='Y' AND is_approved='Y';");
		if(!isset($counter['total'])) $counter = array('total'=>$this->fake_counter());
		return $counter['total'];
	}
	
	/**
	* Find number of tags
	*/
	public function count_tags()
	{
		$counter = $this->row("SELECT COUNT(*) total FROM gallery_tags WHERE is_active='Y' AND is_approved='Y';");
		if(!isset($counter['total'])) $counter = array('total'=>$this->fake_counter());
		return $counter['total'];
	}
	
	/**
	* Find number of colors
	*/
	public function count_colors()
	{
		$counter = $this->row("SELECT COUNT(*) total FROM gallery_colors WHERE is_active='Y' AND is_approved='Y';");
		if(!isset($counter['total'])) $counter = array('total'=>$this->fake_counter());
		return $counter['total'];
	}
}
?>